from typing import List


class Solution:
    def exchange(self, nums: List[int]) -> List[int]:
        i,j=0,len(nums)-1
        while i<j:
            while i<j and nums[i]%2!=0:
                i+=1
            while i < j and nums[j] % 2 == 0:
                j-=1
            print(i,j)
            temp=nums[i]
            nums[i]=nums[j]
            nums[j]=temp
        return nums
if __name__ == '__main__':
    s=Solution()
    ans=s.exchange(
[1,2,3,4])
    print(ans)